import BaseModule from '../BaseModule';
import componentCol from './index';
import { rescueTeamServer, sicknessServer, materialServer, medicalServer, compreSituationServer } from '@/api/installServer';

export default class Module extends BaseModule {


    constructor(opts: any) {
        super(opts);
        this.componentClazzes = componentCol;
    }
    /**
     * 创建组件
     * @param opts {Object}
     */
    public createComponents(opts: any) {
        const components: any = componentCol;
        // 救援队伍
        const rescueTeam = new components.RescueTeam({
            map: this.options.map,
            symbolConfig: this.options.symbolConfig,
            simpleRenderMgr: this.options.GISComponents.simpleRenderMgr,
            PointGeometryBuilder: this.options.GISComponents.PointGeometryBuilder,
            popupManager: this.options.GISComponents.popupManager,
            featureLocate: this.options.GISComponents.featureLocate,
            featureHighlight: this.options.GISComponents.featureHighlight,
            service: rescueTeamServer,
        });
        this.components.rescueTeam = rescueTeam;
        // 病患分布
        const sicknessDistribute = new components.SicknessDistribute({
            map: this.options.map,
            mapConfig: this.options.mapConfig,
            symbolConfig: this.options.symbolConfig,
            simpleRenderMgr: this.options.GISComponents.simpleRenderMgr,
            PointGeometryBuilder: this.options.GISComponents.PointGeometryBuilder,
            popupManager: this.options.GISComponents.popupManager,
            featureLocate: this.options.GISComponents.featureLocate,
            featureHighlight: this.options.GISComponents.featureHighlight,
            service: sicknessServer,
        });
        this.components.sicknessDistribute = sicknessDistribute;
        // 物资分布
        const material = new components.Material({
            map: this.options.map,
            symbolConfig: this.options.symbolConfig,
            simpleRenderMgr: this.options.GISComponents.simpleRenderMgr,
            PointGeometryBuilder: this.options.GISComponents.PointGeometryBuilder,
            popupManager: this.options.GISComponents.popupManager,
            featureLocate: this.options.GISComponents.featureLocate,
            featureHighlight: this.options.GISComponents.featureHighlight,
            service: materialServer,
            showLevel: 16,
        });
        this.components.material = material;
        // 医疗分布
        const medical = new components.Medical({
            map: this.options.map,
            symbolConfig: this.options.symbolConfig,
            simpleRenderMgr: this.options.GISComponents.simpleRenderMgr,
            PointGeometryBuilder: this.options.GISComponents.PointGeometryBuilder,
            popupManager: this.options.GISComponents.popupManager,
            featureLocate: this.options.GISComponents.featureLocate,
            featureHighlight: this.options.GISComponents.featureHighlight,
            service: medicalServer,
        });
        this.components.medical = medical;
        // 综合态势
        const compresituation = new components.CompreSituation({
            map: this.options.map,
            mapConfig: this.options.mapConfig,
            symbolConfig: this.options.symbolConfig,
            simpleRenderMgr: this.options.GISComponents.simpleRenderMgr,
            PointGeometryBuilder: this.options.GISComponents.PointGeometryBuilder,
            popupManager: this.options.GISComponents.popupManager,
            featureLocate: this.options.GISComponents.featureLocate,
            featureHighlight: this.options.GISComponents.featureHighlight,
            service: compreSituationServer,
        });
        this.components.compresituation = compresituation;
    }
}
